package kr.haggenna.sevice.dao;

import java.util.List;
import java.util.Map;

import kr.haggenna.sevice.domain.ServiceCommand;

import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Component;

@Component
public class ServiceDaoImpl  extends SqlSessionDaoSupport implements ServiceDao{

	@Override
	public List<ServiceCommand> list(Map<String, Object> map) {
		List<ServiceCommand> list = getSqlSession().selectList("selectServiceList",map);
		return list;
	}

	@Override
	public void insertService(ServiceCommand serviceCommand) {
		getSqlSession().insert("serviceInput", serviceCommand);
		
	}

	@Override
	public void delete(Integer service_num) {
		getSqlSession().delete("deleteService", service_num);
	}

	@Override
	public ServiceCommand selectService(int service_num) {
		ServiceCommand serviceCommand = getSqlSession().selectOne("selectService", service_num);
		return serviceCommand;
	}

	@Override
	public int getRowCount(Map<String, Object> map) {
		return getSqlSession().selectOne("selectServiceCount", map);
	}

	@Override
	public ServiceCommand getCurrentService(ServiceCommand serviceCommand) {
		ServiceCommand service= getSqlSession().selectOne("getCurrentService", serviceCommand);
		return service;
	}
	
	@Override
	public void updateReplyService(ServiceCommand serviceCommand) {
		getSqlSession().update("updateReplyService", serviceCommand);
	}
	
	@Override
	public int getServiceListByAction() {
		int count = getSqlSession().selectOne("getServiceListByAction");
		return count;
	}
}
